//导入vue
import Vue from '../node_modules/vue/dist/vue.js'
//导入入口组件App.vue
import App from './App.vue'
// import router from './router'
import store from './store'
//按需导入Mint UI组件
import { Header,Button, Swipe, SwipeItem,Lazyload,Switch } from 'mint-ui'
Vue.component(Header.name, Header)
Vue.component(Button.name, Button)
Vue.component(Swipe.name, Swipe)
Vue.component(SwipeItem.name, SwipeItem)
Vue.use(Lazyload)
Vue.component(Switch.name, Switch);
//导入mui样式表
import './lib/mui/css/mui.min.css'
import './lib/mui/css/icons-extra.css'
//1.1导入路由模块
import VueRouter from 'vue-router'
//1.3导入自定义路由文件
import router from './router/router.js'
//导入mock
import './mock/index.js'
//导入axios
import axios from 'axios'
//1.2安装路由模块
Vue.use(VueRouter)
//安装图片预览插件
import VuePreview from 'vue-preview'
Vue.use(VuePreview)
//定义全局过滤器，格式化时间
Vue.filter('dateFormat',function(dateStr,parent=''){
  var dt=new Date(dateStr)
  var Y=dt.getFullYear()
  var M=dt.getMonth()
  var D=dt.getDate()
  if(parent.toLowerCase()==='yyyy-mm-dd'){
    return `${Y}-${M}-${D}`
  }else{
    var h=dt.getHours().toString().padStart(2,'0')
    var m=dt.getMinutes().toString().padStart(2,'0')
    var s=dt.getSeconds().toString().padStart(2,'0')
    return `${Y}-${M}-${D} ${h}:${m}:${s}`
  }
})

Vue.config.productionTip = false
//在Vue中挂载axios
Vue.prototype.$http= axios

new Vue({
  el:"#app",
  store,
  render:(h) =>h(App),
  //1.4 将路由模块挂载到实例上
  router
})
